<template>
  <div class="app-container">
    <!-- 医院信息 -->
    <h5 class="titleInfo">订单基础信息</h5>
    <el-form ref="list" :inline="true" :model="list" label-width="130px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="订单号">
            <span class="spanToInput">{{list.order_sn | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="plus会员卡名称">
            <span class="spanToInput">{{list.card_name | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="商品名称">
            <span class="spanToInput">{{list.shop_name | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="昵称">
            <span class="spanToInput">{{list.nickname | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="姓名">
            <span class="spanToInput">{{list.realname | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="手机号">
            <span class="spanToInput">{{list.phone | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="用户类型">
            <span class="spanToInput">{{list.role_name | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="下单时间">
            <span class="spanToInput">{{list.order_time |data}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="订单状态">
            <span class="spanToInput">{{list.order_status_name | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="订单应付金额">
            <span class="spanToInput">{{list.order_price | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="会员优惠金额">
            <span class="spanToInput">{{list.plus_price | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="抵扣积分">
            <span class="spanToInput">{{list.deduction_integral | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="优惠券金额">
            <span class="spanToInput">{{list.coupon_price | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="订单支付金额">
            <span class="spanToInput">{{list.pay_price | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="支付方式">
            <span class="spanToInput">{{list.pay_name | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="支付流水号">
            <span class="spanToInput">{{list.out_trade_no | filterNull}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="支付时间">
            <span class="spanToInput">{{list.paytime |data}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="备注">
            <span class="spanToInput">{{list.remark | filterNull}}</span>
          </el-form-item>
        </el-col>
      </el-row>
    <!-- 汇款单回款信息 -->
    <div class="divBar"></div>
    <h5 class="titleInfo">订单内容</h5>
    
      <el-form-item label="商家卡券" >
        <!-- <template  slot-scope="scope"> -->
          <el-table :data="shop" style="width: 850px" border>
            <el-table-column prop="source" label="优惠券类型" align="center"/>
            <el-table-column prop="scope" label="适用范围" align="center"/>
            <el-table-column prop="name" label="优惠券名称" align="center"/>
            <el-table-column prop="corresponding" label="优惠券对应服务" align="center"/>
            <el-table-column prop="validity_time" label="有效期" align="center">
              <template slot-scope="scope">
               {{scope.row.validity_time.split(' ')[0] + '-'+scope.row.validity_time.split(' ')[3] }}
              </template>
            </el-table-column>
            <el-table-column prop="num" label="张数" align="center"/>
          </el-table>
        <!-- </template> -->
      </el-form-item>
      <el-form-item label="平台卡券	" >
        <!-- <template  slot-scope="scope"> -->
          <el-table :data="goods" style="width: 850px" border>
            <el-table-column prop="source" label="优惠券类型" align="center"/>
            <el-table-column prop="scope" label="适用范围" align="center"/>
            <el-table-column prop="name" label="优惠券名称" align="center"/>
            <el-table-column prop="corresponding" label="优惠券对应服务" align="center"/>
             <el-table-column prop="validity_time" label="有效期" align="center">
              <template slot-scope="scope">
               {{scope.row.validity_time.split(' ')[0] + '-'+scope.row.validity_time.split(' ')[3] }}
              </template>
            </el-table-column>
            <el-table-column prop="num" label="张数" align="center"/>
          </el-table>
        <!-- </template> -->
      </el-form-item>
       <el-form-item label="医美卡券" >
        <!-- <template  slot-scope="scope"> -->
          <el-table :data="project" style="width: 850px" border>
            <el-table-column prop="source" label="优惠券类型" align="center"/>
            <el-table-column prop="scope" label="适用范围" align="center"/>
            <el-table-column prop="name" label="优惠券名称" align="center"/>
            <el-table-column prop="corresponding" label="优惠券对应服务" align="center"/>
            <el-table-column prop="validity_time" label="有效期" align="center">
              <template slot-scope="scope">
               {{scope.row.validity_time.split(' ')[0] + '-'+scope.row.validity_time.split(' ')[3] }}
              </template>
            </el-table-column>
            <el-table-column prop="num" label="张数" align="center"/>
          </el-table>
        <!-- </template> -->
      </el-form-item>
   </el-form>
  </div>
</template>
<script>
import {cardInfo} from "@/api/orderMange";

export default {
  data() {
    return {
      id: "",
      list: {},
      shop:[],
      goods:[],
      project:[],

    };
  },
  filters: {
    filterNull(e) {
      if (!e) {
        return "暂无";
      } else {
        return e;
      }
    },
    data: function (data) { 
      if(data==0){
        return '--'
      }else{
       var d = new Date(data*1000);
            var year = d.getFullYear();
            var month = d.getMonth()+1;
            var date = d.getDate();
            var hour = d.getHours();
            var minute = d.getMinutes();
            var second = d.getSeconds();
      return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
      }
    }
  },
  created() {
    this.id = String(this.$route.query.id);
 
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      cardInfo({
        id: this.id
      })
        .then(res => {
          if (res.data.code == 200) {
            this.list = res.data.data;
            this.shop = this.list.tickets.shop;
            this.goods = this.list.tickets.goods;
            this.project = this.list.tickets.project;
          } else {
            this.$message.error(res.data.msg);
          }
        })
        .catch(error => {
          this.$message.error(error);
        });
    }
  }
};
</script>

<style scoped>
.app-container {
  padding: 0px !important;
}
.form {
  margin-left: 268px;
}
</style>